/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tradeplus.admin.service;

import com.tradeplus.admin.dao.SystemPropertyDao;
import com.tradeplus.admin.model.SystemProperty;

/**
 *
 * @author ronnie
 */
public class AdminServiceImpl implements AdminService {
    
    private SystemPropertyDao systemPropertyDao;
    
    /**
     * Retrieves System Property value by key.
     *
     * @param key
     * @return System Property Value
     */
    @Override
    public String getValueForSystemProperty(String key) {

        String value = null;
        SystemProperty property = this.getSystemProperty(key);

        if(property!=null){
            value = property.getValue();
        }
        return value;
    }
    
    /**
     * Retrieve SystemProperty object for given key.
     *
     * @param key
     * @return SystemProperty object
     */
    private SystemProperty getSystemProperty(String key) {
        return systemPropertyDao.findByKey(key);
    }
}
